#!/usr/bin/env bash
set -euo pipefail

# realpath not available on Mac by default...
realpath() {
    [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}

if [ $# -gt 0 ] ; then
	numprocesses=$1
else
	numprocesses='auto'
fi
CURRENT_DIR=$(dirname "$0")
ROOT_DIR="$(realpath $(dirname "$0")/..)"

echo "Running tests with Python 3... (HTML coverage report)"
cd $ROOT_DIR
python3 -m pytest --cov=icloudpd --cov-report html --cov-report term-missing --numprocesses $numprocesses
